using System;
using System.Linq;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;

namespace PrimeCalculator
{
    public static class ChartService
    {
        public static void DisplaySimpleChart(double[] values, string title)
        {
            var series = new ISeries[]
            {
                new LineSeries<double>
                {
                    Values = values,
                    Name = title,
                    Stroke = new SolidColorPaint(SKColors.Blue, 2),
                    Fill = null
                }
            };
            
            Console.WriteLine($"=== {title} Chart ===");
            Console.WriteLine(string.Join(", ", values.Select(v => v.ToString("F2"))));
            Console.WriteLine();
        }

        public static void DisplayRegressionResults(double[] xValues, double[] yValues, 
                                                  double slope, double intercept)
        {
            Console.WriteLine("=== Regression Analysis ===");
            Console.WriteLine($"Equation: y = {intercept:F2} + {slope:F2}x");
            Console.WriteLine("Data Points:");
            for (int i = 0; i < xValues.Length; i++)
            {
                Console.WriteLine($"  x={xValues[i]:F2}, y={yValues[i]:F2}");
            }
            Console.WriteLine();
        }
    }
}